package com.sjzs.web.action;

import java.io.File;
import java.util.List;

import org.springframework.beans.BeanUtils;

import com.sjzs.web.common.BaseAction;
import com.sjzs.web.po.Category;
import com.sjzs.web.po.User00;
import com.sjzs.web.vo.AppInfo;
import com.sjzs.web.dao.AppSoftDao;
import com.sjzs.web.dao.CategoryDao;
import com.sjzs.web.po.Appsoft;

public class AppSoftAction extends BaseAction {
	private static final long serialVersionUID = 1L;
	private AppInfo appsoft;
	private File productfile;
	private File iconfile;
	private File coverfile;
	private File screenfile;
	private File qualfile;
	
	private CategoryDao categoryDao;
	private List<Category> lstCategory;
	private AppSoftDao appsoftDao;
	public AppSoftDao getAppsoftDao() {
		return appsoftDao;
	}
	public void setAppsoftDao(AppSoftDao appsoftDao) {
		this.appsoftDao = appsoftDao;
	}
	public List<Category> getLstCategory() {
		return lstCategory;
	}
	public void setLstCategory(List<Category> lstCategory) {
		this.lstCategory = lstCategory;
	}
	public CategoryDao getCategoryDao() {
		return categoryDao;
	}
	public void setCategoryDao(CategoryDao categoryDao) {
		this.categoryDao = categoryDao;
	}
	public File getProductfile() {
		return productfile;
	}
	public void setProductfile(File productfile) {
		this.productfile = productfile;
	}
	public File getIconfile() {
		return iconfile;
	}
	public void setIconfile(File iconfile) {
		this.iconfile = iconfile;
	}
	public File getCoverfile() {
		return coverfile;
	}
	public void setCoverfile(File coverfile) {
		this.coverfile = coverfile;
	}
	public File getScreenfile() {
		return screenfile;
	}
	public void setScreenfile(File screenfile) {
		this.screenfile = screenfile;
	}
	public File getQualfile() {
		return qualfile;
	}
	public void setQualfile(File qualfile) {
		this.qualfile = qualfile;
	}
	public AppInfo getAppsoft() {
		return appsoft;
	}
	public void setAppsoft(AppInfo appsoft) {
		this.appsoft = appsoft;
	}
	/**
	 * 添加应用上传
	 * @return
	 */
	public String addAppSoft(){
		this.lstCategory = this.categoryDao.searchAllCategory();
		return SUCCESS;
	}
	/**
	 * 保存应用
	 * @return
	 */
	public String saveAppSoft() throws Exception{
		Appsoft app = new Appsoft();
		BeanUtils.copyProperties(this.appsoft, app);
		User00 user = super.getUser00();
		app.setUserid(user.getDevuid());
		app.setIcoguid("icon");
		this.appsoftDao.saveAppsoft(app);
		return SUCCESS;
	}
}
